<template>
  <div>
    <TLC :title="title" :contents="contents" @softTag="softTag" @listItemTag="listItemTag" />
  </div>
</template>

<script>
import { SHOW_HELP } from "../server";
export default {
  layout: "main",
  components: {
    TLC: () => import("~/components/other/tlc")
  },
  data() {
    return {
      title: {
        tit: this.$route.query.title,
        soft: true
      },
      contents: {}
    };
  },
  created() {
    this.getList();
  },
  methods: {
    getList() {
      SHOW_HELP({
        id: this.$route.query.id,
        type: this.$route.query.type
      }).then(res => {
        if (!res) return;
        if (this.$route.query.type == "cate") {
          this.contents = {
            types: "Array",
            list: res.data,
            n: "title"
          };
        } else {
          this.contents = {
            types: "richtext",
            richtext: res.data.test
          };
        }
      });
    },
    softTag() {
      this.$router.go(-1);
    },
    listItemTag(item) {
      this.$router.push({
        path: "/consult/help/msg",
        query: { id: item.help_id, title: item.title, type: "help" }
      });
    }
  }
};
</script>
<style lang="less" scoped>
</style>
